namespace classifier_test
{

struct cont_scheme
{
	double lower_bound, upper_bound;

	bool valid(double Val) const;
	cont_domain to_domain() const;
	void format(file_formatter& Fmt);
	void serialize(serializer& Serializer);
};

struct discr_scheme
{
public:
	const int& count;

	discr_scheme();
	discr_scheme(const discr_scheme& Val);
	discr_scheme& operator=(const discr_scheme& Val);
	void clear();
	int get_count() const;
	void set_count(int Val);
	const string& get_value(int I) const;
	void set_value(int I, const string& Val);
	int find(const string& Val) const;
	int add(const string& Val);
	int enter(const string& Val);
	bool exist(const string& Val) const;
	void sort();
	bool valid(int Val) const;
	discr_domain to_domain() const;
	void format(file_formatter& Fmt);
	void serialize(serializer& Serializer);

private:
	typedef multimap<string, int> value_map;

	int Count;
	vector<value_map::iterator> Values;
	value_map Map;
};

struct attribute_scheme
{
	string name;
	attribute_type type;
	cont_scheme cont;
	discr_scheme discr;

	attribute_scheme();
	void clear();
	bool valid(attribute_value Val) const;
	attribute_domain to_domain() const;
	void format(file_formatter& Fmt);
	void format_names(file_formatter& Fmt);
	void serialize(serializer& Serializer);
};

struct record_scheme : public array<attribute_scheme>
{
public:
	explicit record_scheme(int SetSize = 0, const attribute_scheme& SetValue = attribute_scheme());
	bool valid(const record& Val) const;
	record_domain to_domain() const;
	void load(const string& Filename);
	void load_names(const string& Filename);
	void save(const string& Filename) const;
	void save_names(const string& Filename) const;
	void format(file_formatter& Fmt);
	void format_names(file_formatter& Fmt);
	void serialize(serializer& Serializer);
	static file_formatter get_formatter(FILE* File);

private:
	void format(file_formatter& Fmt, bool Names);
};

record_scheme make_scheme(const string& Filename);

}
